#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin >> t;
	while( t-- ){
		double y;
		cin >> y;
		double l = 0.0 , r = 100.0 , mid = 0.0 , sum = 0.0;
		bool flag = false;
		while( fabs( l - r ) >= 0.0001 ){
			mid = ( l + r ) / 2.0;
			sum = 2018.0 * pow( mid , 4 ) + 5.0 * pow( mid ,  3 ) 
			+ 5.0 * pow( mid , 2 ) + 21.0 * mid + 14.0;
			if( sum > y ) r = mid ;
			else if( sum < y ) l = mid ;
			else if( sum == y ){
				flag = true;
				break;
			}
			
		}
		if( flag ) printf("%.4lf\n",mid); 
		else{
			mid = ( l + r ) / 2.0;
			double mid1 = mid + 0.0001;
			double mid2 = mid - 0.0001;
			double x1 = 2018.0 * pow( mid1 , 4 ) + 5.0 * pow( mid1 ,  3 ) 
			+ 5.0 * pow( mid1 , 2 ) + 21.0 * mid1 + 14.0;
			double x2 = 2018.0 * pow( mid2 , 4 ) + 5.0 * pow( mid2 ,  3 ) 
			+ 5.0 * pow( mid2 , 2 ) + 21.0 * mid2 + 14.0;
			if( y >= x2 && y <= x1 ){
				int x = int( mid * 100000.0 ) % 10;
				if( x >= 5 ) mid = ( int( mid * 10000.0 ) + 1 ) / 10000.0;
				else mid = ( int( mid * 10000.0 ) ) / 10000.0;
				
				
////				cout << mid <<endl;
				int num = int(mid * 10000 );
//				cout << mid << " " << num<<endl;
				bool mark = true , mark2 = true;
				if( num % 10000 == 0 ){
					mark2 = false;
					num /= 10000;
					double sum1 = 2018.0 * pow( num , 4 ) + 5.0 * pow( num ,  3 ) 
						+ 5.0 * pow( num , 2 ) + 21.0 * num + 14.0;
					if( y != sum1 ){
						mark = false;
					}
				}
				if( !mark2 && !mark ) printf("-1\n");
				else if( !mark2 && mark ) printf("%d\n",num);
				else if( mark2 ) printf("%.4lf\n",mid);
//				else printf("%.4lf\n",mid);
			} 
			else printf("-1\n");
		}
	}
	return 0;
} 
